load("@rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "snapshotdb",
    srcs = [
        "errors.go",
        "snapshot_crud.go",
        "snapshotdb.go",
    ],
    importpath = "github.com/pachyderm/pachyderm/v2/src/internal/snapshotdb",
    visibility = ["//src:__subpackages__"],
    deps = [
        "//src/internal/errors",
        "//src/internal/pachsql",
        "//src/internal/pgjsontypes",
        "//src/internal/storage/fileset",
        "//src/snapshot",
        "//src/version",
        "@com_github_jmoiron_sqlx//:sqlx",
        "@org_golang_google_grpc//codes",
        "@org_golang_google_grpc//status",
        "@org_golang_google_protobuf//types/known/timestamppb",
    ],
)

go_test(
    name = "snapshotdb_test",
    srcs = [
        "snapshot_crud_test.go",
        "snapshotdb_test.go",
    ],
    embed = [":snapshotdb"],
    deps = [
        "//src/internal/clusterstate",
        "//src/internal/dbutil",
        "//src/internal/dockertestenv",
        "//src/internal/errors",
        "//src/internal/migrations",
        "//src/internal/pachsql",
        "//src/internal/pctx",
        "//src/internal/require",
        "//src/internal/storage/chunk",
        "//src/internal/storage/fileset",
        "//src/internal/storage/kv",
        "//src/internal/storage/track",
        "//src/internal/testetcd",
        "//src/snapshot",
        "@com_github_google_go_cmp//cmp",
        "@org_golang_google_protobuf//testing/protocmp",
    ],
)
